﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using UAC;

namespace UACManager
{
    public partial class DocDefForm : Form
    {
        public DocDefForm()
        {
            InitializeComponent();
        }

        private void DocDefForm_Load(object sender, EventArgs e)
        {

        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            string _docDefId = tDocDefID.Text;
            string _name = tName.Text;
            string _desc = tDesc.Text;

            if (string.IsNullOrEmpty(_docDefId) || string.IsNullOrEmpty(_name))
            {
                MessageBox.Show("为空！", "警告");
                return;
            }
            int docDefId;
            if (!int.TryParse(_docDefId, out docDefId))
            {
                MessageBox.Show("DocDefId格式错误！", "警告");
                return;
            }
            try
            {
                Utils.CreateDocumentDef(docDefId, _name, _desc, "");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "警告");
                return;
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
    }
}
